﻿using System.Windows;
using System.Windows.Input;

namespace MDCAdminTool.Commands
{
    public class SaveConfigCacheCluster : AsyncCommandBindingBase
    {
        public SaveConfigCacheCluster() : base()
        {
            Command = Application.Current.Resources["SaveConfigCacheCluster"] as ICommand;
        }

        protected override void OnExecuted( object sender , ExecutedRoutedEventArgs e )
        {
            var cluster = e.Parameter as CacheCluster;
            if ( cluster != null )
            {
                cluster.UseCacheCluster();
                cluster.LoadCacheHosts();
                // TODO: 
                MainWindow.ReLoadClusterTreeView();
            }
        }
    }
}